/*
 * 文件名: BaseTabActivity.java
 * 版    权：  Copyright PingAn Technology All Rights Reserved.
 * 描    述: [所有tabwidget子Activity的基类]
 * 创建人: EX-YUWEI001
 * 创建时间: 2011-12-22
 * 
 * 修改人：
 * 修改时间:
 * 修改内容：[修改内容]
 */
package com.longevityassistant.activity;

import android.app.Activity;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ViewFlipper;
import app.log.APPLog;

/**
 * [tabWidget子Activity基类]<BR>
 * [功能详细描述]
 * 
 * @author EX-YUWEI001
 * @version [Android PABank C01, 2011-12-22]
 */
public class BaseTabActivity extends Activity{

	/**
	 * debug Tag
	 */
	protected final String TAG = this.getClass().getSimpleName();

	/** 判断是否被初始化 */
	protected boolean isInit;
	/** 父Activity */
	public BaseTabParentActivity parentActivity;
	/**
	 * 
	 */
	public View mSelfView;
	/**
	 * 当前Activity的ID
	 */

	protected String ActivityId;

	/**
	 * 当前被选中的Activity的index
	 */
	protected int checkIndex;
	/**
	 * 父Activity容器
	 */
	ViewFlipper bodyView;
	/** 请求action **/
//	NetPayAction action;

	public ViewFlipper getBodyView() {
		return bodyView;
	}

	public void setBodyView(ViewFlipper bodyView) {
		this.bodyView = bodyView;
	}

	public String getActivityId() {
		return ActivityId;
	}

	public void setActivityId(String activityId) {
		ActivityId = activityId;
	}

	/**
	 * TODO 初始化子Activity，在主Activity中进行调用
	 */
	public void init() {
		isInit = true;
	}

	/**
	 * [获取父Activity]<BR>
	 * [功能详细描述]
	 * 
	 * @return 父Activity
	 */
	public BaseTabParentActivity getParentActivity() {

		return this.parentActivity;

	}

	/**
	 * TODO 设置父activity
	 * 
	 * @param instance
	 *            父Activity实例
	 */
	public void setParentActivity(BaseTabParentActivity instance) {
		this.parentActivity = instance;

	}

	/**
	 * TODO 判断当前Activity是否被初始化
	 * 
	 * @return true: 当前子Activity已被初始化, false:当前Activity未被初始化
	 */
	public boolean isInit() {
		return isInit;
	}

	/**
	 * [搜索返回时在主Acitivity的OnActivityResult中调用]<BR>
	 * [功能详细描述]
	 */
	public void onActivityResult(int requestCode, Object... data) {

	}

	/**
	 * [进入当前子Activity时的操作,在滑动动画结束时调用]<BR>
	 * [功能详细描述]
	 */
	public void onIntoScreen(int requestCode, Object... data) {

	}

	/**
	 * TODO 离开当前Activity时进行的操作
	 */
	public void onLeaveScreen() {

	}

	/**
	 * TODO Activity结束时进行的操作
	 */
	public void onScreenEnd() {

	}

	/**
	 * [一句话功能简述]<BR>
	 * [功能详细描述]
	 * 
	 * @return
	 */
	public View getSelfView() {
		return this.mSelfView;
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		APPLog.i(TAG, "onKeyDown:" + keyCode);
		getParentActivity().onKeyDown(keyCode, event);
		if (keyCode == KeyEvent.KEYCODE_BACK) {
			return true;
		}
		return super.onKeyDown(keyCode, event);
	}

	/**
	 * [一句话功能简述]<BR>
	 * [功能详细描述]
	 * 
	 * @param selfView
	 */
	public void setSelfView(View selfView) {

		this.mSelfView = selfView;
	}

	public int getCheckIndex() {
		return checkIndex;
	}

	public void setCheckIndex(int checkIndex) {
		this.checkIndex = checkIndex;
	}

	public void hideKeybord() {

	}
}
